<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <ui:composition template="Template.xhtml">
        <ui:define name="top">
            #{bundle.solution}#{bundle.detail} 

        </ui:define>
        <ui:define name="content">
            <f:metadata>
                <f:viewParam name="idsolution" value="#{solutionViewMB.idsolutionparam}"/> 

            </f:metadata>
            <f:event listener="#{solutionViewMB.prerender()}"
                     type="preRenderView"></f:event>
            <!--<p:outputPanel deferred="true" >-->
            <!--<shiro:hasPermission name="user:V">--> 
            <h:form id="form">


                <p:panel>
                    <div class="left"><h3>#{bundle.solution}#{bundle.basic}#{bundle.info}</h3></div> 
                    <p:panelGrid styleClass="noborder left" columns="5" style="width: 70%">
                        <h:outputText value="#{bundle.id}" />
                        <h:outputText value="#{solutionViewMB.solution.idsolution}" />
                        <div style="width: 130px"/>
                        <h:outputText value="#{bundle.depot}" />
                        <h:outputText value="#{solutionViewMB.solution.idproblem.iddepot.name}" />
                        <h:outputText value="创建#{bundle.date}" />
                        <h:outputText value="#{solutionViewMB.solution.createdate}">
                            <f:convertDateTime pattern="YYYY/MM/dd" />
                        </h:outputText>
                        <br />
                        <h:outputText value="#{bundle.tranCost}" />
                        <h:outputText value="#{solutionViewMB.solution.tranCost}">
                            <f:convertNumber type="number"  />
                        </h:outputText>
                        <h:outputText value="#{bundle.timeCost}" />
                        <h:outputText value="#{solutionViewMB.solution.timeCost}">
                            <f:convertNumber type="number"  />
                        </h:outputText>
                        <br />
                        <h:outputText value="#{bundle.dispatchCost}" />
                        <h:outputText value="#{solutionViewMB.solution.dispatchCost}">
                            <f:convertNumber type="number" />
                        </h:outputText>
                        <h:outputText value="#{bundle.status}" />
                        <h:outputText value="#{solutionViewMB.solution.state}" converter="#{stateConvert}">

                        </h:outputText>
                    </p:panelGrid>
                    <p:panelGrid styleClass="noborder left" columns="3"   >
                        <p:commandButton update="@this" action="#{solutionViewMB.execute()}" disabled="#{solutionViewMB.status==0}" value="#{bundle.execute}" />

                        <p:button value="#{bundle.view}配送路线图" rendered="#{solutionViewMB.solution.state==1}" outcome="/admin/solution/solution.xhtml" >
                            <f:param name="idsolution" value="#{solutionViewMB.solution.idsolution}" />
                        </p:button> 
                        <p:button value="#{bundle.back}" outcome="/admin/problem/view.xhtml" >
                            <f:param name="idproblem" value="#{solutionViewMB.solution.idproblem.idproblem}" />
                        </p:button>
                    </p:panelGrid>
                    <p:separator />

                    <div class="left"><h3>#{bundle.task}#{bundle.assigned}</h3></div> 

                    <ui:repeat var="task" value="#{solutionViewMB.solution.taskList}">
                        <p:accordionPanel  multiple="true" class="left">

                            <p:tab title="#{bundle.vehicle}:#{task.idattendance.idvehicle.plate} | #{bundle.driver}:#{task.idattendance.iddriver.iduser.name}">
                                <div class="left"><h3>#{bundle.task}#{bundle.basic}#{bundle.info}</h3></div> 
                                <p:panelGrid styleClass="noborder left" columns="5"   >
                                    <h:outputText value="#{bundle.id}" />
                                    <h:outputText value="#{task.idtask}" />  
                                    <div style="width: 130px"/>
                                    <h:outputText value="#{bundle.driver}" />
                                    <h:outputText value="#{task.idattendance.iddriver.iduser.name}" /> 
                                    <h:outputText value="#{bundle.vehicle}" />
                                    <h:outputText value="#{task.idattendance.idvehicle.plate}" /> 
                                    <br />
                                    <h:outputText value="#{bundle.tranCost}" />
                                    <h:outputText value="#{task.tranCost}" >
                                        <f:convertNumber type="number" />
                                    </h:outputText>
                                    <h:outputText value="#{bundle.timeCost}" />
                                    <h:outputText value="#{task.timeCost}" >
                                        <f:convertNumber type="number" />
                                    </h:outputText>
                                    <br />
                                    <h:outputText value="#{bundle.dispatchCost}" />
                                    <h:outputText value="#{task.dispatchCost}"> 
                                        <f:convertNumber type="number" />
                                    </h:outputText>
                                    <h:outputText value="#{bundle.capacity}" />
                                    <h:outputText value="#{task.idattendance.idvehicle.capacity}"> 
                                        <f:convertNumber type="number" />
                                    </h:outputText>
                                    <br />
                                    <h:outputText value="#{bundle.realcapacity}" />
                                    <h:outputText value="#{task.realcap}"> 
                                        <f:convertNumber type="number" />
                                    </h:outputText>
                                    <h:outputText value="#{bundle.begintime}" />
                                    <h:outputText value="#{task.begintime}"> 
                                        <f:convertDateTime pattern="HH:mm"  />
                                    </h:outputText>
                                    <br />
                                    <h:outputText value="#{bundle.finishtime}" />
                                    <h:outputText value="#{task.finishtime}"> 
                                        <f:convertDateTime pattern="HH:mm"  />
                                    </h:outputText>
                                </p:panelGrid>
                                <p:separator />
                                <div class="left"><h3>#{bundle.order}#{bundle.info}</h3></div> 
                                <h:form>


                                    <p:dataTable var="taskCd" value="#{task.taskCustomerdemandList}" paginator="true" rows="10"
                                                 paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                                                 rowsPerPageTemplate="5,10,15"   id="Table" styleClass="textcenter">
                                        <p:column headerText="#{bundle.order}#{bundle.id}" sortBy="#{taskCd.idcustomerdemand.idcustomerdemand}" filterBy="#{taskCd.idcustomerdemand.idcustomerdemand}" >
                                            <h:outputText value="#{taskCd.idcustomerdemand.idcustomerdemand}" />
                                        </p:column>
<!--                                        <p:column headerText="#{bundle.date}" sortBy="#{taskCd.idcustomerdemand.servicedate}" filterBy="#{taskCd.idcustomerdemand.servicedate}">
                                            <h:outputText value="#{taskCd.idcustomerdemand.servicedate}">
                                                <f:convertDateTime pattern="YYYY/MM/dd"  />
                                            </h:outputText>
                                        </p:column>-->

                                        <p:column headerText="#{bundle.username}" sortBy="#{taskCd.idcustomerdemand.idcustomer.iduser.name}" filterBy="#{taskCd.idcustomerdemand.idcustomer.iduser.name}">
                                            <h:outputText value="#{taskCd.idcustomerdemand.idcustomer.iduser.name}" />
                                        </p:column>
                                        <p:column headerText="#{bundle.tel}" sortBy="#{taskCd.idcustomerdemand.tel}" filterBy="#{taskCd.idcustomerdemand.tel}">
                                            <h:outputText value="#{taskCd.idcustomerdemand.tel}" />
                                        </p:column>
                                        <p:column headerText="#{bundle.address}" sortBy="#{taskCd.idcustomerdemand.address}" filterBy="#{taskCd.idcustomerdemand.address}">
                                            <h:outputText value="#{taskCd.idcustomerdemand.address}" />
                                        </p:column>
                                        <p:column headerText="#{bundle.readyTime}" sortBy="#{taskCd.idcustomerdemand.readyTime}">

                                            <h:outputText value="#{taskCd.idcustomerdemand.readyTime}">
                                                <f:convertDateTime pattern="HH:mm" />
                                            </h:outputText>
                                        </p:column>
                                        <p:column headerText="#{bundle.dueDate}" sortBy="#{taskCd.idcustomerdemand.dueDate}">
                                            <h:outputText value="#{taskCd.idcustomerdemand.dueDate}">
                                                <f:convertDateTime pattern="HH:mm"  />
                                            </h:outputText>
                                        </p:column>
                                        <p:column headerText="预计#{bundle.arrivetime}" sortBy="#{taskCd.arrivetime}">
                                            <h:outputText value="#{taskCd.arrivetime}">
                                                <f:convertDateTime pattern="HH:mm"  />
                                            </h:outputText>
                                        </p:column>
                                        <p:column headerText="#{bundle.serviceTime}" sortBy="#{taskCd.idcustomerdemand.serviceTime}" >
                                            <h:outputText value="#{taskCd.idcustomerdemand.serviceTime}" />
                                        </p:column>
                                        <p:column headerText="#{bundle.demand}" sortBy="#{taskCd.idcustomerdemand.requirement}" style="width: 6%">
                                            <h:outputText value="#{taskCd.idcustomerdemand.requirement}" />
                                        </p:column>
                                        <p:column headerText="顺序" sortBy="#{taskCd.visiteorder}" style="width: 6%">
                                            <h:outputText value="#{taskCd.visiteorder}" />
                                        </p:column>

                                    </p:dataTable>
                                    <p:blockUI block="Table" trigger="Table">
                                        LOADING<br />
                                        <p:graphicImage name="img/ajaxloadingbar.gif"/>
                                    </p:blockUI>

                                </h:form>
                                <p:separator />
                            </p:tab>

                        </p:accordionPanel>
                    </ui:repeat>



                </p:panel>

            </h:form>
            <!--</p:outputPanel>-->
            <!--</shiro:hasPermission>-->
        </ui:define>
    </ui:composition>
</html>

